#pragma once
#include "Singleton.hpp"
#include <functional>
#include <map>
#include <memory>
#include <string>
class HttpConnection;
typedef std::function<void(std::shared_ptr<HttpConnection>)> HttpHandler;
class LogicSystem : public Singleton<LogicSystem>,
                    std::enable_shared_from_this<LogicSystem> {
  friend Singleton<LogicSystem>;

private:
  std::map<std::string, HttpHandler> _post_handles;
  std::map<std::string, HttpHandler> _get_handles;

private:
  LogicSystem();

public:
  LogicSystem(const LogicSystem &) = delete;
  LogicSystem &operator=(const LogicSystem &) = delete;
  ~LogicSystem();
  bool HandleGet(std::string, std::shared_ptr<HttpConnection>);
  void RegGet(std::string, HttpHandler);
  bool HandlePost(std::string, std::shared_ptr<HttpConnection>);
  void RegPost(std::string, HttpHandler);
};